//
//  ForgetScreen.m
//  Gekko
//
//  Created by jose on 30/06/13.
//  Copyright (c) 2013 Jose Luis Lopez. All rights reserved.
//

#import "ForgetScreen.h"

@interface ForgetScreen ()

@end

@implementation ForgetScreen

@synthesize labelSlogan, labelUser, buttonBack, buttonReset, inputUser;

- (void)viewDidLoad
{
    [super viewDidLoad];
	
    [labelSlogan setText:NSLocalizedString(@"SLOGAN", nil)];
    [labelSlogan setFont:[UIFont fontWithName:kFontBold size:16]];
    
    [labelUser setText:NSLocalizedString(@"USERNAME", nil)];
    [labelUser setFont:[UIFont fontWithName:kFontBold size:16]];
    
    [inputUser setFont:[UIFont fontWithName:kFontLight size:16]];
    
    [buttonReset setTitle:NSLocalizedString(@"RESET PASSWORD", nil) forState:UIControlStateNormal];
    [buttonReset.titleLabel setFont:[UIFont fontWithName:kFontBold size:16]];
    
    [buttonBack setTitle:NSLocalizedString(@"BACK TO LOGIN", nil) forState:UIControlStateNormal];
    [buttonBack.titleLabel setFont:[UIFont fontWithName:kFontBold size:16]];
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped:)];
    [self.view addGestureRecognizer:tap];
}

-(void)tapped:(UITapGestureRecognizer *)gesture {
    
    [inputUser resignFirstResponder];
}

- (IBAction)resetPressed:(UIButton *)sender {


    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"OK", nil), nil];
    
    if ([inputUser.text length] == 0) {
        [alert setMessage:NSLocalizedString(@"PASSWORD RESTORED NULL", nil)];
    }
    
    // Request
    //If fail
    if (YES) {
        [alert setMessage:NSLocalizedString(@"PASSWORD RESTORED FAILED", nil)];
    }
    // If success
    if (YES) {
        [alert setMessage:NSLocalizedString(@"PASSWORD RESTORED", nil)];
        [alert setDelegate:self];
    }
    
    [alert show];
}

- (IBAction)backPressed:(UIButton *)sender {

    [self.navigationController popViewControllerAnimated:YES];
}

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)viewDidUnload {
    [self setLabelSlogan:nil];
    [super viewDidUnload];
}
@end
